package example;

import example.template.IService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class SJMS_Application {

    public static void main(String[] args) {
        ConfigurableApplicationContext run = SpringApplication.run(SJMS_Application.class, args);

        String makeType = run.getEnvironment().getProperty("makeType");
        // 第一种方法
//        IService bean = MyApplicationContext.getBean(makeType, IService.class);
        IService bean = (IService) run.getBean(makeType);
        bean.doService();

        // 第二种方法
//        DoServiceMap doServiceMap = run.getBean("doServiceMap", DoServiceMap.class);
//        IService doService02 = doServiceMap.getIServiceImpl(makeType);
//        System.out.println(doService02);
    }

}
